<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/easyui/themes/icon.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/easyui/locale/easyui-lang-zh_CN.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>办理任务</title>
</head>
<body>

<div style="width:60%;height:300px;padding-bottom: 10px;"  >
	<div class="easyui-panel" title="${roleName }审批" fit="true">
		<table style="width:60%;height:70%;padding:10px">
			<tr>
				<td align="right">请假人：</td>
				<td><input type="text" id="leaveName" name="leaveName" readonly="readonly" value="${user.userNickname }"> </td>
				<td  align="right"> 请假天数：</td>
				<td><input type="text" id="leaveDay" name="leaveDay" readonly="readonly" value="${leave.leaveDay }"></td>
			</tr>
			<tr>
				<td  valign="top"  align="right">请假原因：</td>
				<td valign="top" colspan="3">
					<textarea style="resize:none" readonly="readonly" rows="3" cols="63">${leave.leaveReason }</textarea>
				</td>
			</tr>
			<tr>
				<td  valign="top"  align="right">批注：</td>
				<td valign="top" colspan="3">
					<textarea id="comment"  style="resize:none" rows="3" cols="63"></textarea>
				</td>
			</tr>
			<tr>
				<td></td>
				<td valign="top" colspan="3">
					<a id="btn" href="javascript:handleApply('ok')" class="easyui-linkbutton" data-options="iconCls:'icon-ok'">批准</a>  
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<c:if test="${roleName=='项目组长' }">
						<a id="btn" href="javascript:handleApply('no')" class="easyui-linkbutton" data-options="iconCls:'icon-no'">驳回</a>  
					</c:if>
				</td>
			</tr>
		</table>
	</div>
</div>
<div style="width:60%;height:300px">
	<div class="easyui-panel" title="批注列表" fit="true">
		<table id="reviewTable" fit="true"></table>
	</div>
</div>
<input type="hidden" id="taskId" value="${taskId }"/>
</body>
<script type="text/javascript">
$(function(){
	$("#reviewTable").datagrid({
		url:"${pageContext.request.contextPath}/",
		fitColumns:true,
		rownumbers:true,
		pagination:true,
		singleSelect:true,
		columns:[[
			{field:"reviewTime",title:"批注时间",width:2,align:"center"},
			{field:"reviewPerson",title:"批注人",width:3,align:"center"},
			{field:"reviewContent",title:"批注信息",width:2,align:"center"}
		]]
	})
	
})

function handleApply(flg){
	var taskId = $("#taskId").val();
	var comment = $("#comment").val();
	$.ajax({
		url:"${pageContext.request.contextPath}/approveTask",
		aysnc:true,
		type:"post",
		data:{
			flg:flg,
			taskId:taskId,
			comment:comment
		},
		success:function(data){
			if(data=="success"){
				$.messager.alert("","操作成功!","info",function(){
					var jq = top.jQuery;
					parent.reloadTabGrid("待办任务管理");
			        jq("#myTabs").tabs('close', "办理任务"); 
				});
			}else{
				$.messager.alert("","操作失败,请联系管理员!","info");
			}
		}
	})
	
	
	
	
	
	
}

</script>
</html>